<html>
<head><meta charset="utf-8"><title>Why is repr(simd) only allowed on tuple structs? · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Why.20is.20repr(simd).20only.20allowed.20on.20tuple.20structs.3F.html">Why is repr(simd) only allowed on tuple structs?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212387506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Why%20is%20repr%28simd%29%20only%20allowed%20on%20tuple%20structs%3F/near/212387506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Why.20is.20repr(simd).20only.20allowed.20on.20tuple.20structs.3F.html#212387506">(Oct 06 2020 at 05:57)</a>:</h4>
<p>This came up as a question in the portable SIMD group and I was hoping for a T-lang perspective because maybe someone remembers the discussions around the RFC that introduced <code>repr(simd)</code>.</p>
<p>Essentially, was there discussion with having <code>repr(simd)</code> work on newtype'd arrays rather than tuple structs? Because tuple structs worl well for 64 and 128 bit simd, but with 256 bit and 512 but simd it gets kinda silly, particularly u8 simd (eg: u8x64 has 64 fields).</p>
<p>We don't specifically <em>need</em> a change, it's ultimately only a small deal, but if anyone has an explanation of how it came to be that'd be neat.</p>



<a name="212404319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Why%20is%20repr%28simd%29%20only%20allowed%20on%20tuple%20structs%3F/near/212404319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Why.20is.20repr(simd).20only.20allowed.20on.20tuple.20structs.3F.html#212404319">(Oct 06 2020 at 09:37)</a>:</h4>
<p>I've thought that arrays would be better than tuples for SIMD since (checks IRLO) 2016, apparently, <span class="user-mention" data-user-id="224471">@Lokathor</span> <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>
<p>This PR conversation from 2013 might be of interest: <a href="https://github.com/rust-lang/rust/pull/5841">https://github.com/rust-lang/rust/pull/5841</a></p>



<a name="212404475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Why%20is%20repr%28simd%29%20only%20allowed%20on%20tuple%20structs%3F/near/212404475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Why.20is.20repr(simd).20only.20allowed.20on.20tuple.20structs.3F.html#212404475">(Oct 06 2020 at 09:39)</a>:</h4>
<p>It almost happened last year, too: <a href="https://github.com/rust-lang/rust/pull/63531">https://github.com/rust-lang/rust/pull/63531</a></p>
<p>Apparently I commented on it:</p>
<blockquote>
<p>I've wanted this for literally years -- doing i8x32 with fields is just miserable.</p>
</blockquote>



<a name="212404654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Why%20is%20repr%28simd%29%20only%20allowed%20on%20tuple%20structs%3F/near/212404654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Why.20is.20repr(simd).20only.20allowed.20on.20tuple.20structs.3F.html#212404654">(Oct 06 2020 at 09:41)</a>:</h4>
<p>So you even have a signed-off lang FCP to make that work (in unstable), if you want.</p>



<a name="212426989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Why%20is%20repr%28simd%29%20only%20allowed%20on%20tuple%20structs%3F/near/212426989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Why.20is.20repr(simd).20only.20allowed.20on.20tuple.20structs.3F.html#212426989">(Oct 06 2020 at 13:28)</a>:</h4>
<p>I don't think <span class="user-mention" data-user-id="224471">@Lokathor</span> there was a strong reason to do one over the other.</p>



<a name="212495327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Why%20is%20repr%28simd%29%20only%20allowed%20on%20tuple%20structs%3F/near/212495327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Why.20is.20repr(simd).20only.20allowed.20on.20tuple.20structs.3F.html#212495327">(Oct 06 2020 at 22:45)</a>:</h4>
<p><em>Cool</em></p>



<a name="212495356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Why%20is%20repr%28simd%29%20only%20allowed%20on%20tuple%20structs%3F/near/212495356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Why.20is.20repr(simd).20only.20allowed.20on.20tuple.20structs.3F.html#212495356">(Oct 06 2020 at 22:45)</a>:</h4>
<p>We're doing it, crabs! We're making it happen!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>